/*
 * @Date         : 2024-05-12 17:37:07 星期0
 * @Author       : xut
 * @Description  :
 */
import grpc from "@grpc/grpc-js"
import protoLoader from "@grpc/proto-loader"

export function loadProto(file) {
  const packageDefinition = protoLoader.loadSync(file, {
    keepCase: true,
    longs: String,
    enums: String,
    defaults: true,
    oneofs: true,
  })

  const protoDescriptor = grpc.loadPackageDefinition(packageDefinition)

  return protoDescriptor
}
